Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Case] Add in-progress status to case #84321

Merged
merged 17 commits into from
Dec 4, 2020

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Nov 25, 2020

Summary

This PR adds the in-progress status to cases and changes the UI to accommodate the new change. Specifically:

Case single page view

  • The Close case/Open case button has been removed from the action bar.
  • The case status label on the action bar has changed to a dropdown menu. The user can change the status from the dropdown menu.

Before:

Screenshot 2020-11-26 at 11 11 20 AM

After:

Screenshot 2020-11-26 at 11 04 41 AM

Screenshot 2020-11-26 at 11 04 48 AM

  • The user actions show status changes

Screenshot 2020-11-26 at 11 05 25 AM

  • When the status of the case is open the bottom button changes to Mark in progress.

Screenshot 2020-11-26 at 11 05 10 AM

Demo

status_2

All cases view

  • The in-progress stat has been added.

Screenshot 2020-11-26 at 11 19 24 AM

  • The Open/Close filter button has been changed to a dropdown menu.

Screenshot 2020-11-26 at 11 19 34 AM

Demo

status_1

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas self-assigned this Nov 25, 2020
@cnasikas cnasikas added release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.11.0 v8.0.0 Feature:Cases Cases feature labels Nov 25, 2020
@cnasikas cnasikas marked this pull request as ready for review November 26, 2020 09:30
@cnasikas cnasikas requested review from a team as code owners November 26, 2020 09:30

interface LabelTitle {
action: CaseUserActions;
field: string;
}

const getStatusTitle = (status: CaseStatus) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could make a component from that function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because If I create a component from that I should do it for every title I think is best to do it as a tech dept on another PR.

@cnasikas cnasikas force-pushed the cases_change_status branch from 309bada to 65f591d Compare December 1, 2020 21:49
@cnasikas
Copy link
Member Author

cnasikas commented Dec 3, 2020

@elasticmachine merge upstream

<EuiContextMenuItem
key={status}
icon={status === currentStatus ? 'check' : 'empty'}
onClick={onContextMenuItemClick(status)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onClick={onContextMenuItemClick(status)}
onClick={() => onContextMenuItemClick(status)}

need to make this an anon/lambda function or onContextMenuItemClick will get invoked on render for each menu item

Copy link
Member Author

@cnasikas cnasikas Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onContextMenuItemClick function returns another function that is memoized along with the status. This is a trick to avoid the callback and potential rerenders.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!! bookmarking this for the future ;)

@cnasikas cnasikas force-pushed the cases_change_status branch from 30f1f39 to 9c89f76 Compare December 4, 2020 15:34
Comment on lines 33 to 36
const [nextStatusIndex, setNextStatusIndex] = useState(getNextItem(indexOfCurrentStatus));

// The useEffect is needed to update status updates from the context menu.
useEffect(() => setNextStatusIndex(getNextItem(indexOfCurrentStatus)), [indexOfCurrentStatus]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [nextStatusIndex, setNextStatusIndex] = useState(getNextItem(indexOfCurrentStatus));
// The useEffect is needed to update status updates from the context menu.
useEffect(() => setNextStatusIndex(getNextItem(indexOfCurrentStatus)), [indexOfCurrentStatus]);
const nextStatusIndex = useMemo(() => getNextItem(indexOfCurrentStatus), [indexOfCurrentStatus]);

This should work, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or not because of your onClick?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or does onStatusChanged change the indexOfCurrentStatus which would update the useMemo??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onClick needs the state. onStatusChanged does not change the indexOfCurrentStatus.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong. It can be done as you said!

@cnasikas cnasikas force-pushed the cases_change_status branch from f754a6f to 9db8736 Compare December 4, 2020 17:20

// The useEffect is needed to update status updates from the context menu.
useEffect(() => setNextStatusIndex(getNextItem(indexOfCurrentStatus)), [indexOfCurrentStatus]);
const nextStatusIndex = useMemo(() => getNextItem(indexOfCurrentStatus), [indexOfCurrentStatus]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! LGTM. Thanks for making those changes. I've had it on my to do list to strictly type status since the start. Great work @cnasikas 🚀 🎸

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2097 2105 +8

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 8.0MB 8.0MB +11.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 209.3KB 210.5KB +1.2KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants